Skip to main content

Django Migrations

Overview

Migrations are a common solution to the problem of database management in a version controlled code source. Technologies that utilize migrations include Python Django, Ruby on Rails, and C# EF (dotnet core). From the Real Python article, Django Migrations: A Primer, the following problems are addressed by migrations:

  • Making database changes without SQL
  • Avoiding repetition
  • Ensuring the model definitions and database schema are in sync
  • Tracking database schema changes in version control (Git)

Migration standards

  • Once a project has been released, migrations should NEVER be deleted. All database changes should be made via new migrations. This includes undoing previous migrations.
  • If a project is still in pre-release mode, it can sometimes be okay to delete migrations. If you want to delete migrations, confer with or notify the entire project support team.

If you have any questions regarding migrations in Django or any other language, contact Jake.